import pytest,time
import os
from common.fileFunc import fileOperation
# 初始化文件操作的类
file = fileOperation()
# 读取配置/环境的文件
resList = file.readYaml('common/environment.yaml')

currentTime = time.strftime("%Y%m%d%H%M%S", time.localtime())
if __name__ == '__main__':
    # 执行自动化脚本，并保存测试结果

    # pytest.main(["-sq","--alluredir",'/var/lib/jenkins/workspace/innisfree_api_autotest/allure_resFile'])

    pytest.main(["-sq","--alluredir",'results/resFile'+currentTime])
    # os.system("pytest -s -q --alluredir results/resFile"+currentTime)
    # file.shutil_older('results/allure_resFile')
    # pytest.main(["-sq", "--alluredir", 'results/allure_resFile'])



    # 生成allure测试报告

    #os.system("allure generate --clean -c results/resFile --clean -o results/report")

    os.system("allure generate --clean -c results/resFile"+currentTime+" -o results/report"+currentTime)


